{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This script can be used to extract as sub-volume from one of your images. Let's assume we have this one.\n",
    "![FLAIR](images/flair.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "with the dimensions 181x217"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Informations obtained from image header:\n",
      "header type=<class 'nibabel.nifti1.Nifti1Image'>\n",
      "voxel spacing=(1.0, 1.0)\n",
      "offset=(-0.0, -0.0)\n",
      "\n",
      "Informations obtained from image array:\n",
      "datatype=float32,dimensions=2,shape=(181, 217)\n",
      "first and last element: 0.0 / 0.0\n"
     ]
    }
   ],
   "source": [
    "medpy_info.py resources/flair.nii.gz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can now cut out the middle part with"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "medpy_extract_sub_volume.py resources/flair.nii.gz output/subvolume.nii.gz 60:120,70:140"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "which results in\n",
    "![Subvolume](images/subvolume.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As usual for *medpy*, the script works for images of all dimensions."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Bash",
   "language": "bash",
   "name": "bash"
  },
  "language_info": {
   "codemirror_mode": "shell",
   "file_extension": ".sh",
   "mimetype": "text/x-sh",
   "name": "bash"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
